var {
  randomUtils,
  clickUtils,
  logUtils,
  existContent,
  clickContent,
} = require("../../utils/index");
var { App } = require("../../base/index");
var pointMap = require("./pointMap");
var baiDuJiSu = new App("百度极速版", {
  // interval: 20 * 60,
  // maxRunTCount: 3,
  
});
var aRead = require("./aRead");
var aTreasure = require("./aTreasure");
var aInvite = require("./aInvite");
baiDuJiSu.runTest = function (count) {
  logUtils.info(this.name, "runTest", count, "/", this.maxRunTCount);
  if (count == 0) {
    sleep(randomUtils.getRandom(2.5, 10, 1000));
    return;
  }
  if (count == 1) {
    this.firstToTask();
    return;
  }
  if (count == 2) {
    this.firstToInvite();
    return;
  }
  return;
};
baiDuJiSu.firstToInvite = function () {
  sleep(randomUtils.getRandom(2.5, 5, 1000));
  clickUtils.clickPointMap(pointMap.首页.我的);
  sleep(randomUtils.getRandom(2, 4, 1000));
  var content = "邀请好友";
  if (clickContent(content)) {
    sleep(randomUtils.getRandom(2, 4, 1000));
  }
};
baiDuJiSu.firstToTask = function () {
  sleep(randomUtils.getRandom(2.5, 5, 1000));
  clickUtils.clickPointMap(pointMap.首页.任务);
  sleep(randomUtils.getRandom(2, 4, 1000));
  var content = "可以提现";
  var exist = existContent(content);
  if (exist) {
    clickUtils.clickPointMap(pointMap.任务.可以提现啦.关闭);
    sleep(randomUtils.getRandom(2, 4, 1000));
    this.checkSign();
    return;
  }
  this.checkSign();
};
baiDuJiSu.checkSign = function () {
  var content = "直接领取";
  if (clickContent(content)) {
    sleep(randomUtils.getRandom(2, 3, 1000));
    var content = "我知道了";
    if (clickContent(content)) {
      sleep(randomUtils.getRandom(2, 3, 1000));
    }
    return;
  }
  return;
};
baiDuJiSu.run = function () {
  aRead.flow();
  aTreasure.flow();
  aInvite.flow();
};
module.exports = baiDuJiSu;
